package com.estun.backroundManagementService.enums;

public enum FactoryMesDeviceStatusEnum {
    NORMAL("normal", "正常", "0", "运行"),
    REPAIR("repair", "报修", "4", "报修"),
    MAINTAIN("maintain", "维修", "2", "故障"),
    SCRAP("scrap", "报废", "5", "报废"),
    ON_MACHINE("onMachine", "上机", "6", "上机"),
    IN_LIBRARY("inLibrary", "在库", "7", "在库"),
    IN_MAINTAIN("inMaintain", "保养", "8", "保养"),
    OVERHAUL("overhaul", "检修", "9", "检修"),
    CH_M_AND_T("chMandT", "换模/换工装", "10", "换模/换工装"),
    FAULT("fault", "故障", "11", "故障"),
    FREE("free", "空闲", "1", "待机"),
    OFFLINE("offline", "离线", "3", "停机");

    /**
     * @param deviceStatusStr 产线mes设备状态编码
     * @return
     */
    public static FactoryMesDeviceStatusEnum getByDeviceStatus(String deviceStatusStr) {
        switch (deviceStatusStr) {
            case "系统运行":
                return NORMAL;
            case "系统故障":
                return MAINTAIN;
            case "维护模式":
                return IN_MAINTAIN;
        }
        return NORMAL;
    }

    private final String code;
    private final String name;
    private final String value;
    private final String description;

    FactoryMesDeviceStatusEnum(String code, String name, String value, String description) {
        this.code = code;
        this.name = name;
        this.value = value;
        this.description = description;
    }

    // 以下是 Getter 方法，根据需要可以添加其他方法

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }
}
